package com.itheima.mapper;

import com.itheima.domain.Classes;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface ClassesMapper {

    @Select("select * from classes")
    @Results({
            //封装班级基本信息
            @Result(column = "cid",property = "cid",id = true),
            @Result(column = "cname",property = "cname"),
            //封装班级学生集合信息
            @Result(
                    property = "studentList",
                    javaType = List.class,
                    column = "cid",
                    many = @Many(select ="com.itheima.mapper.StudentMapper.findByCid" )

            )
    })
    public List<Classes> findAll();
}
